#!/usr/bin/env python
# -*- coding:utf-8 -*-

from flask_restful import Api

from . import user_blueprint
from api_1_0.userResource.userResource import UserResource
from api_1_0.userResource.userOtherResource import UserOtherResource

api = Api(user_blueprint)

api.add_resource(UserResource, '/<user_id>', '', endpoint='User')


@user_blueprint.route('/update/<user_id>', methods=['PUT'], endpoint='UserUpdate')
def update(user_id):
    return UserOtherResource.sensitive_update(user_id)


# 用户注册
@user_blueprint.route('/register', methods=['POST'], endpoint='UserRegister')
def register():
    return UserOtherResource.user_register()

# 用户登录
@user_blueprint.route('/login', methods=['POST'], endpoint='UserLogin')
def login():
    return UserOtherResource.login()

# 修改密码
@user_blueprint.route('/modifyPassword', methods=['PUT'], endpoint='UserModifyPassword')
def modify_password():
    return UserOtherResource.modify_password()

# 获取当前登录的用户信息
@user_blueprint.route('/me', methods=['GET'], endpoint='UserMe')
def me():
    return UserOtherResource.me()
